const express = require('express')
const userCtrl = require('../../controller/user')
const userValidator = require('../../validator/user')
// 中间件
const auth = require('../../middleware/auth')
const timeAuth = require('../../middleware/time-handler')

const router = express.Router()

// 用户登录
router.post('/user/login',timeAuth, userValidator.login, userCtrl.login)

// 用户注册
router.post('/user/register',timeAuth, userValidator.register, userCtrl.register)

// 找回用户账号和重置密码
router.post('/user/forget',timeAuth, userValidator.forgetUser, userCtrl.forgetUser)

// 检查当前登录用户
router.get('/user/check',timeAuth, auth, userCtrl.check)

module.exports = router